import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import('../views/index.vue'),
  },
  // PC页面
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/PC/index.vue'),
  },
  // 移动设备主要页面
  {
    path: '/m',
    component: () => import('@/views/M/index.vue'),
    children: [
      {
        // 我的
        path: 'me',
        component: () => import('@/views/M/home_page/me.vue'),
      },
      {
        // 主页
        path: 'index',
        component: () => import('@/views/M/home_page/index.vue'),
      },
      {
        // 软文推送
        path: 'push',
        component: () => import('@/views/M/home_page/push.vue'),
      },
    ],
  },
  {
    // 登录
    path: '/m/login',
    component: () => import('@/views/M/home_page/login.vue'),
  },
  {
    // 个人信息
    path: '/m/detailed',
    component: () => import('@/views/M/home_page/me/detailed.vue'),
  },
  {
    // 购物车
    path: '/m/mycar',
    component: () => import('@/views/M/home_page/me/shopping_car.vue'),
  },
  {
    // 消息
    path: '/m/chat',
    component: () => import('@/views/M/home_page/me/chat.vue'),
  },
  {
    // 搜索
    path: '/m/search',
    component: () => import('@/views/M/home_page/search/index.vue'),
  },
  // 移动设备商店页面
  {
    path: '/m/store',
    component: () => import('@/views/M/store/routes.vue'),
    children: [
      {
        // 主页
        path: 'index',
        component: () => import('@/views/M/store/index.vue'),
      },
      {
        // 商品
        path: 'goods',
        component: () => import('@/views/M/store/goods.vue'),
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
